<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>媒体查询</title>
    <style>
        div {width: 200px; height: 200px; background: black;}
        @media screen and (max-width: 500px) {
            div {background: red;}
        }
        @media screen and (min-width:501px) and (max-width:1000px) {
            div {background: yellow;}
        }
    </style>
</head>
<body>
    <div></div>
</body>
</html>